import type { UserInfoRes } from "@/serivce/modules/users/types";
import { defineStore } from "pinia";
import type { UserState } from "./types";

export const useUserStore = defineStore({
    id:'user',
    state:():UserState =>({
        sessionId:'',
        securityConfigType: '',
        userInfo:{}
    }),
    persist:true,
    getters: {
        getSessionId():string{
            return this.sessionId
        },
        getSecurityConfigType():string{
            return this.securityConfigType
        },

        getUserInfo():UserInfoRes|{} {
            return this.userInfo
        }

    },
    actions: {
        setSessionId(sessionId:string):void {
            this.sessionId = sessionId
        },
        setSecurityConfigType(securityConfigType:string): void {
            this.securityConfigType = securityConfigType
        },
        
        setUserInfo(userInfo:UserInfoRes|{}):void{
            this.userInfo = userInfo
        }
    }
})